<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pdfs extends CI_Controller {
     function __construct(){
        parent::__construct();
        $this->load->library('cezpdf');
        $this->load->helper('pdf_helper');   
     }

/* PDF listado de materias */
public function materias_pdf(){
 $session_id = $this -> session -> userdata('logged_alum');
   if($session_id){
            base_pdf();
            //Encabezado del documento
            $this->load->model('student/consultas_m');
            $this->cezpdf->ezText('<b>Itec Leonardo Da vinci</b>');
            $this->cezpdf->ezText('<b>Carrera:</b>');
            $this->cezpdf->ezText('<b>Fecha :</b> '.date('Y-m-d'));
            $this->cezpdf->ezText('');
            //Contenido del documento
           $result= $this->consultas_m->materias_list();
             foreach ($result as $rs):
                  $data[] = array(
                  'Codigo' => $rs -> codi_mat,
                  'Descripcion' => $rs -> desc_mate,
                  'Cuatrimestre' => $rs -> desc_cuat,
                  );   
             endforeach;    
              $col_names = array(
                 'Codigo' => 'Codigo',
                 'Descripcion' => 'Descripcion',
                 'Cuatrimestre' => 'Cuatrimestre',   
               ); 
            //armo la tabla             
            $this->cezpdf->ezTable($data, $col_names, 'Listado de Materias', array('width'=>550));         
            $this->cezpdf->ezStream(array('Content-Disposition'=>'listadoMaterias.pdf'));
   }else{
        redirect('login');
   }
}
   

		
}
